package gom.example.gramediamajalah;

import org.json.JSONArray;

import org.json.JSONException;
import org.json.JSONObject;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

public class DetailAksesServer {
	private static final String AR_ID = "id";

	JSONArray artikel = null;

	public void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);

		setContentView(R.layout.);

		Intent in = getIntent();

		String kode = in.getStringExtra(AR_ID);

		String link_url = "http://10.0.2.2/json-parsing/detail-artikel.php?kode="
				+ kode;

		JSONParser jParser = new JSONParser();
		JSONObject json = jParser.getJSONFromUrl(link_url);

		try {

			artikel = json.getJSONArray("artikel");

			for (int i = 0; i < artikel.length(); i++) {

				JSONObject ar = artikel.getJSONObject(i);
				String detail_d = ar.getString("title") + " - "
						+ ar.getString("image_filename") + " - "
						+ ar.getString("published");

				String isi_d = ar.getString("content");

			}

		} catch (JSONException e) {

			e.printStackTrace();

		}

	}

}
